<?php
namespace Home\Widget;
use Think\Controller;
class ArticleWidget extends Controller{
	public function index($name,$template='article'){
		$map=array(
			'code'	=> 'feature',
			'name'	=>	$name
			);
		$module=M('Module')->where($map)->find();
		$module=json_decode($module['setting'],true);	
		$articles=array();
		$ArticleModel=D('Article');
		$articles=$ArticleModel->getSomeArticles($module['article']);
		$language_id=get_default_lng_id();
		$article_data=$module['module_description'][$language_id];
		$article_data['url']=U($module['link']);
		$this->assign('articles',$articles);
		$this->assign('data',$article_data);
		$this->display('Widget/' . $template);

	}
}